#include "enemy_sign.h"

ENEMY_SIGN::ENEMY_SIGN(QPoint p, CASH *cash):QGraphicsObject()
{
    im = cash->cash_pixmap->value("Res/Other/Enemy_Sign.png");

    this->setPos(p.x(),p.y()-100);

    this->setZValue(1.0);

    timer_id=startTimer(500);

    time_now=0;

}

void ENEMY_SIGN::timerEvent(QTimerEvent *)
{

    ++time_now;

    if(this->isVisible())
        this->hide();
    else
        this->show();

    if(time_now==6){
        this->hide();
        killTimer(timer_id);
        this->deleteLater();
        emit Kill_Me_Please((QGraphicsObject*)this);
    }

}

QRectF ENEMY_SIGN::boundingRect() const
{

    return QRectF( QPointF(0,0),QPoint(0,0));

}

void ENEMY_SIGN::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{

    painter->save();
    painter->drawPixmap( 0,0,*im);
    painter->restore();

}

ENEMY_SIGN::~ENEMY_SIGN()
{
}




